#!/bin/sh
#chkconfig: 2345 10 90
# description: Starts and Stops the Tomcat daemon.
#by jj
##############################################
#Startup script for Tomcat on Linux

#filename tomcat.sh

#Make sure the java and the tomcat installation path has been added to the PATH
JAVA_HOME=/root/software/jre1.8.0_131                  #JDK安装目录
CATALINA_HOME=/root/software/apache-tomcat-8.5.20           #tomcat安装目录
export JAVA_HOME
export CATALINA_HOME

###############################################
start_tomcat=$CATALINA_HOME/bin/startup.sh              #tomcat启动文件
stop_tomcat=$CATALINA_HOME/bin/shutdown.sh                  #tomcat关闭文件
start() {                                                              
        echo -n "Starting tomcat: "
        ${start_tomcat}
        echo "tomcat start ok."
}
stop() {
        echo -n "Shutting down tomcat: "
        ${stop_tomcat}
        echo "tomcat stop ok."
}
# See how we were called
                                                   
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 10
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
esac
exit 0
